#include "cpu/exec/template-start.h"
#include "cpu/exec/judge_jcc.h"

#define make_setcc(setcc_name) \
    make_helper(concat4(set, setcc_name, _, SUFFIX)) { \
        int len = concat(decode_rm_, SUFFIX)(eip + 1); \
        print_asm("%s\t%s", str(concat(set, setcc_name)), op_src->str); \
        if(concat(judge_, setcc_name)()) {\
            OPERAND_W(op_src, 1); \
        } \
        else { \
            OPERAND_W(op_src, 0); \
        } \
        return len + 1; \
}

make_setcc(e) 
make_setcc(ne)
make_setcc(s)
make_setcc(ns)
make_setcc(p)
make_setcc(np)
make_setcc(o)
make_setcc(no)
make_setcc(b)
make_setcc(nb)
make_setcc(na)
make_setcc(a)
make_setcc(l)
make_setcc(ge)
make_setcc(le)
make_setcc(g)

#include "cpu/exec/template-end.h"